home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-04-23 | 978 b | 36 lines | [TEXT/GEOL] |
- Item 4450622 23-April-90 08:38PDT
-
- From: NAUTIL France - Dev, Nautil Info Lyon,IDV
-
- To: CPLUS.APPLE$ C++ Interest List--Apple Employees
- CPLUS.DEV$ C++ Interest List--Developers
-
- Sub: Dynamic instanciation
-
- Hello,
-
- How can be done "dynamic instanciation" in C++? I would like to create an
- object sometime of class A, sometime of class B, sometime of class C, etc.:
-
- switch(sometime) {
- case makeA:
- x = new A;
- break;
- case makeB:
- x = new B;
- break;
- case makeC:
- x = new C;
- break;
- …
- }
- Problem: A, B, C, etc... are not defined when this code is compiled.
-
- With Object Pascal one can use the "Clone" method or the "InstanceBy…" methods.
- What are equivalent instructions for "not PascalObject" C++ classes?
- ("sometime" could be an ID, an object member or anything else.)
-
- Thanks,
- Etienne Vautherin
-
-